import http from '@/config/axios'
const baseUrl = '/v1/pc/api/chainFileInfo';
const preUrl = '/v1/pc/api'

// 两链管理
// 1.01 主键查询
// export const queryById = id => http.get(`${baseUrl}/${id}`);
// 1.02 分页查询
export const queryByPage = params => http.get(`${baseUrl}`, { params: params });
// 1.03 查询所有
// export const queryAll = () => http.get(`${baseUrl}/queryAll`);
// 2.01 数据新增
export const addData = data => http.post(`${baseUrl}`, data);
// 3.01 部分修改
// export const updateData = ({ id, ...params }) => http.patch(`${baseUrl}/${id}`, params);
// 4.01 删除数据
export const delData = id => http.delete(`${baseUrl}/${id}`);
// 4.02 批量删除数据
export const batchDelData = ids => http.delete(`${baseUrl}/deleteChainFileInfoList`, ids);
// 1.04 查询两链文件分组
export const queryAllGroup = params => http.get(`${baseUrl}/queryChainFileInfoGroupList`, params);

// 目标标准管理
const formWorkUrl = '/v1/pc/api/targetStandardFormwork';
// 1.01 主键查询
export const getFormWorkById = id => http.get(`${formWorkUrl}/${id}`);
// // 1.04 查询年度分组列表
export const queryFormWorkByPage = params => http.get(`${formWorkUrl}/queryTargetStandardGroupList`, { params: params });
// 1.03 查询所有
export const queryFormWorkAll = (data) => http.get(`${formWorkUrl}/queryAll`, { params: data });
// 2.01 数据新增
export const addFormWorkData = data => http.post(`${formWorkUrl}`, data);
// 2.02 复制目标标准
export const copyFormWorkData = data => http.post(`${formWorkUrl}/addCopyTargetStandard`, data);
// 2.03 新增子项
export const addSubTarget = data => http.post(`${formWorkUrl}/addSubTargetStandard`, data);
// 3.01 部分修改
export const updateFormWorkData = (id, data) => http.patch(`${formWorkUrl}/${id}`, data);
// 4.01 删除数据
export const delFormWorkData = id => http.delete(`${formWorkUrl}/${id}`);
// 2.04 下发目标标准
export const releaseFormWork = id => http.post(`${formWorkUrl}/addIssueTargetStandard/${id}`);
// 1.05 查询列表
export const getStandardList = data => http.get(`${formWorkUrl}/queryTargetStandardList`, { params: data });
// 2.05 审核目标标准
export const checkTarget = data => http.post(`${formWorkUrl}/addExamineResultTargetStandard`, data);
// 2.06 发布目标标准
export const releaseTarget = data => http.post(`${formWorkUrl}/addReleaseTargetStandard`, data);

// 我的目标标准、目标标准审核、目标标准查询
const myTargetUrl = '/v1/pc/api/targetStandard';
// 1.01 查询我的目标标准详情
export const getMyTargetById = id => http.get(`${myTargetUrl}/${id}`);
// 1.02 查询目标标准(已审核)
export const getQueryTarget = data => http.get(`${myTargetUrl}/queryReportTargetStandardList`, { params: data });
// 3.01 部分修改
export const updateMyTargetData = (id, data) => http.patch(`${myTargetUrl}/${id}`, data);
// 1.04 我的目标标准-年度卡片分组列表
export const queryMyTarget = data => http.get(`${myTargetUrl}/queryMyTargetStandardList`, { params: data });
// 1.05 目标标准审核-年度卡片分组列表
export const queryCheckTarget = data => http.get(`${myTargetUrl}/queryExamineTargetStandardList`, { params: data });
// 1.06 目标标准查询-年度卡片分组列表
export const queryQueryTarget = data => http.get(`${myTargetUrl}/queryTargetStandardList`, { params: data });
// 4.01 删除数据
export const delMyTarget = id => http.delete(`${myTargetUrl}/${id}`);
// 2.02 提交我的目标标准至审核
export const submitToCheck = id => http.post(`${myTargetUrl}/addExamineTargetStandard/${id}`);
// 1.1.1 查询我负责的所有目标标准
export const queryMyTargetStandardAll = () => http.get(`${myTargetUrl}/queryMyTargetStandardAll`)

// 目标标准管理-质控点操作
const pointUrl = '/v1/pc/api/indexQualityPointInfoFormwork';
// 1.01 根据目标标准id,查询质控点详情
export const getPointDetail = id => http.get(`${pointUrl}/${id}`);
// 1.02 查询质控点列表
export const getPointList = params => http.get(`${pointUrl}`, { params: params });
// 2.01 数据新增
export const addPointData = data => http.post(`${pointUrl}`, data);
// 3.01 修改质控点
export const editPointData = (id, data) => http.patch(`${pointUrl}/${id}`, data);
// 4.01 删除质控点
export const delPointData = (id) => http.delete(`${pointUrl}/${id}`);
// 1.05 设置标准值
export const updateStandardValue = data => http.post(`${pointUrl}/updateIndexQualityPointInfoStandardValue`, data)
// 1.03 查询所有质控点
export const getPointALLList = params => http.get(`${pointUrl}/queryAll`, { params: params });
// 1.05 查询设置标准值中需要值同步的质控点列表
export const getValueSyncPointList = params => http.get(`${pointUrl}/queryIndexQualityPointInfoFormwork`, { params: params });

// 我的目标标准-质控点操作
const myPointUrl = '/v1/pc/api/indexQualityPointInfo';
// 1.02 根据我的目标标准id,查询质控点列表
export const getMyPointList = params => http.get(`${myPointUrl}`, { params: params });
// 1.01 根据目标标准id,查询质控点详情
export const getMyPointDetail = id => http.get(`${myPointUrl}/${id}`);
// 2.01 数据新增
export const addMyPointData = data => http.post(`${myPointUrl}`, data);
// 3.01 修改我的目标标准中的质控点
export const editMyPointData = (id, data) => http.patch(`${myPointUrl}/${id}`, data);
// 3.05 修改我的目标标准中的目标值
export const updateTargetValue = data => http.patch(`${myPointUrl}/updateTargetValue/${data.id}`, data);
// 3.04 修改当前值
export const updateCurrentValue = data => http.patch(`${myPointUrl}/updateCurrentValue`, data);
// 4.01 删除质控点
export const delMyPointData = id => http.delete(`${myPointUrl}/${id}`);

// 更新手工维护值
export const updateHandworkMaintainValue = data => http.patch(`${myPointUrl}/updateHandworkMaintainValue`, data);

// 更新校准值
// export const updateCorrectValue = data => http.patch(`${myPointUrl}/updateCorrectValue/${data.id}?correctValue=${data.correctValue}&startValue=${data.startValue}&cumulativeValue=${data.cumulativeValue}`);
export const updateCorrectValue = data => http.patch(`${myPointUrl}/updateCorrectValue/${data.id}`, data)
//= ===============v1.1================
// 模板管理-质控点操作
// 1.04 查询质控列表
export const getModelPointList = params => http.get(`${preUrl}/indexQualityPointInfoFormwork/queryIndexQualityPointInfoFormworkList`, { params: params })
// 1.06 查询下拉的目标标准
export const getTargetStandardList = params => http.get(`${preUrl}/targetStandardFormwork/queryAllTargetStandardList`, { params: params })
// 2.01 数据新增
export const addModelPointData = params => http.post(`${preUrl}/indexQualityPointInfoFormwork`, params);
// 1.05 目标标准审核-年度卡片分组列表
export const getCheckTargetList = data => http.get(`${preUrl}/targetStandardFormwork/queryExamineTargetStandardList`, { params: data });
// 1.03 查询所有目标标准
export const getTargetStandardListAll = data => http.get(`${preUrl}/targetStandardFormwork/queryAll`, { params: data })
// 修改质控点审核状态
export const updatePointInfoStandardValue = data => http.post(`${preUrl}/indexQualityPointInfoFormwork/updateIndexQualityPointInfoStandardState`, data)
// 批量导入质控点
export const addTemplatePoint = param => http.post(`${preUrl}/indexQualityPointInfoFormwork/addIndexQualityPointInfoFormworkBatch`, param, {
    headers: { 'content-type': 'multipart/form-data' }
})
